<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        //需求：统计字符串中每个字符出现多少次
        const str = "aabbbccde"

        /* 
            输出1：每个字符串出现多少次
            a:2
            b:3
            c:2
            d:1
            e:1
            
            输出2：哪个字符出现的次数最多
         */

         let counta = 0;
         let position = str.indexOf('a')
         console.log(position)
         while(position!==-1){
             counta++;
             position=str.indexOf('a',position+1)
         }
         console.log(counta)
    </script>
</head>

<body>

</body>

</html>